#include "main.h"

#define PI 3.14159265358979f
#define CPR (float)(2.0f*PI)
// AS5047p 地址
#define NOP 0x0000
#define ERRFL 0x0001
#define PROG 0x0003
#define DIAAGC 0x3FFC
#define MAG 0x3FFD
#define ANGLEUNC 0x3FFE
#define ANGLECOM 0x3FFF

#define ZPOSM 0x0016
#define ZPOSL 0x0017
#define SETTINGS1 0x0018
#define SETTINGS2 0x0019

typedef struct
{
    float Now;
    float Pre;
}ENCODER_DATA;

extern ENCODER_DATA Encoder_Data;
extern ENCODER_DATA Encoder_Data_Real;

extern float Encoder_Data_Test;
extern float Speed_Data;
extern float Electrical_Angle;
extern float Electrical_Angle_Offset;
extern float Encoder_Data_Real_Buffer[20];
uint8_t parity_check_uint16(uint16_t data);
void Encoder_Init();
uint16_t Encoder_Read(uint16_t cmd);
float Get_Electrical_Angle(void);


